import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter); //使用vue-router

import i18n from '../lang/index'

//配置导出路由
export default new VueRouter({
  mode: 'history',  // 路径上不带 # 号, hash（默认）路径上带 # 号
  routes:[
    {
      path: '/',
      redirect: '/homePage/hot'
    },
    {
      path:'/homePage',    // 路由的路径
      component: () => import('../components/user/home-page/HomePage'), // 跳转的组件
      meta:{
        title:i18n.t('router.user.websiteHome'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
      children:[
        {
          path: '/homePage',
          redirect: '/homePage/hot'
        },
        {
          // 当 /user/:id/profile 匹配成功，
          // UserProfile 会被渲染在 User 的 <router-view> 中
          path:'hot',
          component: () => import('../components/user/home-page/HotContent'),
          meta:{
            title:i18n.t('router.user.websiteHome'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'error',
          component: () => import('../components/user/home-page/ErrorContent'),
          meta:{
            title:i18n.t('router.user.websiteHome'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'question',
          component: () => import('../components/user/home-page/QuestionContent'),
          meta:{
            title:i18n.t('router.user.websiteHome'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'blink',
          component: () => import('../components/user/home-page/BlinkContent'),
          meta:{
            title:i18n.t('router.user.websiteHome'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
      ]
    },


    {
      path:'/loginRegistrationPage',
      component: () => import('../components/user/login-registration-page/LoginRegistrationPage'),
      meta:{
        title:i18n.t('router.user.loginReg.title'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
      children:[
        {
          path: '/loginRegistrationPage',
          redirect: '/loginRegistrationPage/login'
        },
        {
          // 当 /user/:id/profile 匹配成功，
          // UserProfile 会被渲染在 User 的 <router-view> 中
          path:'login',
          component: () => import('../components/user/login-registration-page/Login'),
          meta:{
            title:i18n.t('router.user.loginReg.login'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'registration',
          component: () => import('../components/user/login-registration-page/Registration'),
          meta:{
            title:i18n.t('router.user.loginReg.registration'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'retrievePassword',
          component: () => import('../components/user/login-registration-page/RetrievePassword'),
          meta:{
            title:i18n.t('router.user.loginReg.retrievePassword'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'resetPassword',
          component: () => import('../components/user/login-registration-page/ResetPassword'),
          meta:{
            title:i18n.t('router.user.loginReg.resetPassword'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        }
      ]

    },


    {
      path:'/worksDisplayPage',
      component: () => import('../components/user/works-display-page/WorksDisplayPage'),
      meta:{
        title:i18n.t('router.user.worksDisplay'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      }
    },


    {
      path:'/userHomePage',
      component: () => import('../components/user/user-home-page/UserHomePage'),
      meta:{
        title:i18n.t('router.user.userHome'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
      children:[
        {
          path:'/userHomePage/',
          redirect: '/userHomePage/error'
        },
        {
          path:'error',
          component: () => import('../components/user/user-home-page/UserArticleCard-error'),
          meta:{
            title:i18n.t('router.user.userHome'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'question',
          component: () => import('../components/user/user-home-page/UserArticleCard-question'),
          meta:{
            title:i18n.t('router.user.userHome'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'blink',
          component: () => import('../components/user/user-home-page/UserBlinkCard'),
          meta:{
            title:i18n.t('router.user.userHome'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
      ]
    },


    {
      path:'/publishPage',
      component: () => import('../components/user/publish-page/PublishPage'),
      meta:{
        title:i18n.t('router.user.publishEdit'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
      children:[
        {
          path:'/publishPage/',
          redirect: '/publishPage/error'
        },
        {
          path:'error',
          component: () => import('../components/user/publish-page/PublishPage-error'),
          meta:{
            title:i18n.t('router.user.publishEdit'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'question',
          component: () => import('../components/user/publish-page/PublishPage-question'),
          meta:{
            title:i18n.t('router.user.publishEdit'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
        {
          path:'blink',
          component: () => import('../components/user/publish-page/PublishPage-blink'),
          meta:{
            title:i18n.t('router.user.publishEdit'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          }
        },
      ]
    },


    {
      path:'/userAdminPage',
      component: () => import('../components/user/user-admin-page/UserAdminPage'),
      meta:{
        title:i18n.t('router.user.userAdmin.title'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
      children:[
        {
          path:'/userAdminPage',
          redirect: '/userAdminPage/myWorks'
        },
        {
          path:'myWorks',
          component: () => import('../components/user/user-admin-page/UserAdminMyWorks'),
          meta:{
            title:i18n.t('router.user.userAdmin.myWorks'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
          children:[
            {
              path:'/userAdminPage/myWorks',
              redirect: '/userAdminPage/myWorks/error'
            },
            {
              path: 'error',
              component: () => import('../components/user/user-admin-page/UserAdminMyWorks-errorCarder'),
              meta:{
                title:i18n.t('router.user.userAdmin.myWorks'),
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path: 'question',
              component: () => import('../components/user/user-admin-page/UserAdminMyWorks-questionCarder'),
              meta:{
                title:i18n.t('router.user.userAdmin.myWorks'),
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path: 'blink',
              component: () => import('../components/user/user-admin-page/UserAdminMyWorks-blinkCarder'),
              meta:{
                title:i18n.t('router.user.userAdmin.myWorks'),
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            }
          ]
        },
        {
          path:'myArticle',
          component: () => import('../components/user/user-admin-page/UserAdminMyArticle'),
          meta:{
            title:i18n.t('router.user.userAdmin.myArticle'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
          children:[
            {
              path: '/userAdminPage/myArticle',
              redirect: '/userAdminPage/myArticle/aboutError'
            },
            {
              path:'aboutError',
              component: () => import('../components/user/user-admin-page/UserAdminMyArticle-error'),
              meta:{
                title:i18n.t('router.user.userAdmin.myArticle'),
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'aboutQuestion',
              component: () => import('../components/user/user-admin-page/UserAdminMyArticle-question'),
              meta:{
                title:i18n.t('router.user.userAdmin.myArticle'),
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            }
          ]
        },
        {
          path:'myData',
          component: () => import('../components/user/user-admin-page/UserAdminMyData'),
          meta:{
            title:i18n.t('router.user.userAdmin.myData'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'myCollection',
          component: () => import('../components/user/user-admin-page/UserAdminMyCollection'),
          meta:{
            title:i18n.t('router.user.userAdmin.myCollection'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'myNews',
          component: () => import('../components/user/user-admin-page/UserAdminMyNews'),
          meta:{
            title:i18n.t('router.user.userAdmin.myNews'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'myAttention',
          component: () => import('../components/user/user-admin-page/UserAdminMyAttention'),
          meta:{
            title:i18n.t('router.user.userAdmin.myAttention'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'myInfo',
          component: () => import('../components/user/user-admin-page/UserAdminInfo'),
          meta:{
            title:i18n.t('router.user.userAdmin.myInfo'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
      ]
    },


    {
      path:'/adminPage/login',
      component: () => import('../components/admin/admin-login/AdminLogin'),
      meta:{
        title:'登录页面-BIDEA管理端',
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
    },
    {
      path:'/adminPage/loginCode',
      component: () => import('../components/admin/admin-login/AdminLoginCode'),
      meta:{
        title:'登录授权-BIDEA管理端',
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
    },
    {
      path:'/adminPage',
      component: () => import('../components/admin/AdminPage'),
      meta:{
        title:'后台管理-BIDEA管理端',
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
      children:[
        {
          path:'/adminPage',
          redirect: '/adminPage/data'
        },
        {
          path:'data',
          component: () => import('../components/admin/admin-data/AdminData'),
          meta:{
            title:'全站数据-BIDEA管理端',
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'news',
          component: () => import('../components/admin/admin-news/AdminNews'),
          meta:{
            title:'举报详情-BIDEA管理端',
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'errorUser',
          component: () => import('../components/admin/admin-error-user/AdminErrorUser'),
          meta:{
            title:'用户管理-BIDEA管理端',
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'publish',
          component: () => import('../components/admin/admin-pulish/AdminPublish'),
          meta:{
            title:'发布消息-BIDEA管理端',
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'ad',
          component: () => import('../components/admin/admin-ad/AdminAD'),
          meta:{
            title:'广告管理-BIDEA管理端',
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
        {
          path:'download',
          component: () => import('../components/admin/admin-download/AdminDownload'),
          meta:{
            title:'下载中心-BIDEA管理端',
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
          children:[
            {
              path: '/adminPage/download',
              redirect: '/adminPage/download/all'
            },
            {
              path:'all',
              component: () => import('../components/admin/admin-download/AdminDownload-all'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'reportedType',
              component: () => import('../components/admin/admin-download/AdminDownload-reportedType'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'userActive',
              component: () => import('../components/admin/admin-download/AdminDownload-userActive'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'userCodeAge',
              component: () => import('../components/admin/admin-download/AdminDownload-userCodeAge'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'userGender',
              component: () => import('../components/admin/admin-download/AdminDownload-userGender'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'userIncrease',
              component: () => import('../components/admin/admin-download/AdminDownload-userIncrease'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'worksIncrease',
              component: () => import('../components/admin/admin-download/AdminDownload-worksIncrease'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'translate',
              component: () => import('../components/admin/admin-download/AdminDownload-translate'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'baike',
              component: () => import('../components/admin/admin-download/AdminDownload-baike'),
              meta:{
                title:'下载中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            }
          ]
        },
        {
          path:'setting',
          component: () => import('../components/admin/admin-setting/AdminSetting'),
          meta:{
            title:'管理中心-BIDEA管理端',
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
          children:[
            {
              path: '/adminPage/setting',
              redirect: '/adminPage/setting/tips'
            },
            {
              path:'tips',
              component:() => import('../components/admin/admin-setting/AdminSetting-Tips'),
              meta:{
                title:'管理中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'router',
              component:() => import('../components/admin/admin-setting/AdminSetting-router'),
              meta:{
                title:'管理中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            },
            {
              path:'cache',
              component:() => import('../components/admin/admin-setting/AdminSetting-cache'),
              meta:{
                title:'管理中心-BIDEA管理端',
                keepAlive:false, //是否缓存
                requireAuth:false //是否需要身份验
              },
            }
          ]
        },
      ]
    },
    {
      path:'/chat',
      component:() => import('../components/user/chat-page/ChatPage'),
      meta:{
        title:i18n.t('router.user.chat'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
      children:[
        {
          path:'/chat',
          redirect:"/chat/chatContent"
        },
        {
          path:'chatContent',
          component:() => import('../components/user/chat-page/ChatPage-Content'),
          meta:{
            title:i18n.t('router.user.chat'),
            keepAlive:false, //是否缓存
            requireAuth:false //是否需要身份验
          },
        },
      ]
    },

    {
      path:'/myselfArticle',
      component: () => import('../components/user/myself_article/MyselfArticle'),
      meta:{
        title:i18n.t('router.user.myselfArticle'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
    },


    { //404路由配合
      path:'*',
      component: () => import('../components/common/Null'),
      meta:{
        title:i18n.t('router.notFound.title'),
        keepAlive:false, //是否缓存
        requireAuth:false //是否需要身份验
      },
    }
  ]
})
